package ru.elteam.web.beans.request;

/**
 * @author Nikita.Brazhnikov
 */
public class AppearanceSettings {
	private Integer maxRecentMessagesConunt = 5;
	private String newMessagesEmail = "";
	private Boolean useRegistrationEmail = true;
	private MessageViewFormat format = null;

	public Integer getMaxRecentMessagesConunt() {
		return maxRecentMessagesConunt;
	}

	public void setMaxRecentMessagesConunt(Integer maxRecentMessagesConunt) {
		this.maxRecentMessagesConunt = maxRecentMessagesConunt;
	}

	public String getNewMessagesEmail() {
		return newMessagesEmail;
	}

	public void setNewMessagesEmail(String newMessagesEmail) {
		this.newMessagesEmail = newMessagesEmail;
	}

	public Boolean getUseRegistrationEmail() {
		return useRegistrationEmail;
	}

	public void setUseRegistrationEmail(Boolean useRegistrationEmail) {
		this.useRegistrationEmail = useRegistrationEmail;
	}

	public MessageViewFormat getFormat() {
		return format;
	}

	public void setFormat(MessageViewFormat format) {
		this.format = format;
	}

	public static class MessageViewFormat {
		private boolean addReply = false;
		private Integer previewLength = 200;

		public Integer getPreviewLength() {
			return previewLength;
		}

		public void setPreviewLength(Integer previewLength) {
			this.previewLength = previewLength;
		}

		public boolean isAddReply() {
			return addReply;
		}

		public void setAddReply(boolean addReply) {
			this.addReply = addReply;
		}

		@Override
		public boolean equals(Object o) {
			if (this == o) return true;
			if (!(o instanceof MessageViewFormat)) return false;

			MessageViewFormat format = (MessageViewFormat) o;

			if (addReply != format.addReply) return false;
			if (previewLength != null ? !previewLength.equals(format.previewLength) : format.previewLength != null) return false;

			return true;
		}

		@Override
		public int hashCode() {
			int result = (addReply ? 1 : 0);
			result = 31 * result + (previewLength != null ? previewLength.hashCode() : 0);
			return result;
		}
	}
}
